import { EnumSchema } from '@/utils/common/types';
import { PresetColorEnum } from '@/enums/colorEnum';
import { useI18n } from '@/hooks/web/useI18n';

/** 生肖枚举 */
export enum ChineseZodiacSignEnum {
  /** 鼠 */
  Rat = 1,
  /** 牛 */
  OX = 2,
  /** 虎 */
  Tiger = 3,
  /** 兔 */
  Rabbit = 4,
  /** 龙 */
  Dragon = 5,
  /** 蛇 */
  Snake = 6,
  /** 马 */
  Horse = 7,
  /** 羊 */
  Sheep = 8,
  /** 猴 */
  Monkey = 9,
  /** 鸡 */
  Rooster = 10,
  /** 狗 */
  Dog = 11,
  /** 猪 */
  Pig = 12,
}

/** 生肖实体 */
export class ChineseZodiacSignEntity {
  /** 生肖 */
  ZodiacSign: ChineseZodiacSignEnum;
  /** 显示描述 */
  Display: string;
  /** 颜色 */
  Color?: PresetColorEnum | string;
  /** 图标 */
  Icon?: string;

  constructor(zodiacSign: ChineseZodiacSignEnum, color?: PresetColorEnum | string) {
    const { t } = useI18n();
    this.ZodiacSign = zodiacSign;
    this.Color = color;
    switch (zodiacSign) {
      case ChineseZodiacSignEnum.Rat:
        // this.Display = '鼠';
        this.Display = t('enum.chineseZodiacSign.rat');
        this.Color = this.Color ? this.Color : '#A52A2A'; // 属鼠代表的颜色：褐色
        this.Icon = 'emojione:rat';
        break;
      case ChineseZodiacSignEnum.OX:
        // this.Display = '牛';
        this.Display = t('enum.chineseZodiacSign.ox');
        this.Color = this.Color ? this.Color : '#808080'; // 属牛代表的颜色：灰色
        this.Icon = 'emojione:ox';
        break;
      case ChineseZodiacSignEnum.Tiger:
        // this.Display = '虎';
        this.Display = t('enum.chineseZodiacSign.tiger');
        this.Color = this.Color ? this.Color : '#f8cd46'; // 属虎代表的颜色：黄色
        this.Icon = 'emojione:tiger';
        break;
      case ChineseZodiacSignEnum.Rabbit:
        // this.Display = '兔';
        this.Display = t('enum.chineseZodiacSign.rabbit');
        this.Color = this.Color ? this.Color : '#e5d3b2'; // 属兔代表的颜色：米色
        this.Icon = 'emojione:rabbit';
        break;
      case ChineseZodiacSignEnum.Dragon:
        // this.Display = '龙';
        this.Display = t('enum.chineseZodiacSign.dragon');
        this.Color = this.Color ? this.Color : '#FFD700'; // 属龙代表的颜色：金色
        this.Icon = 'emojione:dragon';
        break;
      case ChineseZodiacSignEnum.Snake:
        // this.Display = '蛇';
        this.Display = t('enum.chineseZodiacSign.snake');
        this.Color = this.Color ? this.Color : '#9932CD'; // 属蛇代表的颜色：紫色
        this.Icon = 'emojione:snake';
        break;
      case ChineseZodiacSignEnum.Horse:
        // this.Display = '马';
        this.Display = t('enum.chineseZodiacSign.horse');
        this.Color = this.Color ? this.Color : '#1E90FF'; // 属马代表的颜色：蓝色
        this.Icon = 'emojione:horse';
        break;
      case ChineseZodiacSignEnum.Sheep:
        // this.Display = '羊';
        this.Display = t('enum.chineseZodiacSign.sheep');
        this.Color = this.Color ? this.Color : '#008B8B'; // 属羊代表的颜色：青色
        this.Icon = 'emojione:goat';
        break;
      case ChineseZodiacSignEnum.Monkey:
        // this.Display = '猴';
        this.Display = t('enum.chineseZodiacSign.monkey');
        this.Color = this.Color ? this.Color : '#228B22'; // 属猴代表的颜色：绿色
        this.Icon = 'emojione:monkey';
        break;
      case ChineseZodiacSignEnum.Rooster:
        // this.Display = '鸡';
        this.Display = t('enum.chineseZodiacSign.rooster');
        this.Color = this.Color ? this.Color : '#DC143C'; // 属鸡代表的颜色：红色
        this.Icon = 'emojione:rooster';
        break;
      case ChineseZodiacSignEnum.Dog:
        // this.Display = '狗';
        this.Display = t('enum.chineseZodiacSign.dog');
        this.Color = this.Color ? this.Color : '#6600FF'; // 属狗代表的颜色：靛色
        this.Icon = 'emojione:dog';
        break;
      case ChineseZodiacSignEnum.Pig:
        // this.Display = '猪';
        this.Display = t('enum.chineseZodiacSign.pig');
        this.Color = this.Color ? this.Color : '#FF8C00'; // 属猪代表的颜色：橙色
        this.Icon = 'emojione:pig';
        break;
    }
  }
}

//#region 获取生肖枚举架构
/**
 * 获取生肖枚举架构
 */
export function getChineseZodiacSignEnumSchema(enableTag = true): EnumSchema[] {
  const enumSchema: EnumSchema[] = [];
  const entities: ChineseZodiacSignEntity[] = [
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Rat), // 属鼠代表的颜色：褐色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.OX), // 属牛代表的颜色：灰色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Tiger), // 属虎代表的颜色：黄色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Rabbit), // 属兔代表的颜色：米色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Dragon), // 属龙代表的颜色：金色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Snake), // 属蛇代表的颜色：紫色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Horse), // 属马代表的颜色：蓝色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Sheep), // 属羊代表的颜色：青色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Monkey), // 属猴代表的颜色：绿色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Rooster), // 属鸡代表的颜色：红色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Dog), // 属狗代表的颜色：靛色
    new ChineseZodiacSignEntity(ChineseZodiacSignEnum.Pig), // 属猪代表的颜色：橙色
  ];
  entities.forEach((item) => {
    enumSchema.push({
      key: item.ZodiacSign as number,
      label: item.Display,
      value: item.ZodiacSign as number,
      tag: enableTag,
      tagColor: item.Color,
      // tagIcon: item.Icon,
    });
  });
  return enumSchema;
}
//#endregion
